package com.zhongmeng.rxjava2test.bean

import android.os.Parcel
import android.os.Parcelable

import java.util.ArrayList

/**
 * author :rcw.
 * date :2017/10/12 14:23.
 */

class Notice protected constructor(`in`: Parcel) : BaseBean(), Parcelable {

    /**
     * message : 请求成功！
     * noticeList : [{"img_path":"http://owauh0662.bkt.clouddn.com/notice_20170920104225180.jpg","id":58,"notice_date":"2017-09-20 10:44","rownum":5,"title":"发个吧负固不宾","unitname":"系统","send_person":"系统管理员","url":"http://192.168.1.68:8080/cdc_appInterface/noticeManageController/lookNotice.do?noticeid=58"}]
     * totalNum : 5
     * state : 1
     * code : 200
     */

    var totalNum: Int = 0

    var noticeList: ArrayList<NoticeListBean>? = null

    init {
        totalNum = `in`.readInt()
    }

    override fun toString(): String {
        return "Notice{" +
                "totalNum=" + totalNum +
                ", noticeList=" + noticeList +
                '}'
    }

    override fun describeContents(): Int {
        return 0
    }

    override fun writeToParcel(parcel: Parcel, i: Int) {
        parcel.writeInt(totalNum)
    }

    class NoticeListBean protected constructor(`in`: Parcel) : Parcelable {
        /**
         * img_path : http://owauh0662.bkt.clouddn.com/notice_20170920104225180.jpg
         * id : 58
         * notice_date : 2017-09-20 10:44
         * rownum : 5
         * title : 发个吧负固不宾
         * unitname : 系统
         * send_person : 系统管理员
         * url : http://192.168.1.68:8080/cdc_appInterface/noticeManageController/lookNotice.do?noticeid=58
         */

        var img_path: String? = null
        var id: Int = 0
        var notice_date: String? = null
        var rownum: Int = 0
        var title: String? = null
        var unitname: String? = null
        var send_person: String? = null
        var url: String? = null

        init {
            img_path = `in`.readString()
            id = `in`.readInt()
            notice_date = `in`.readString()
            rownum = `in`.readInt()
            title = `in`.readString()
            unitname = `in`.readString()
            send_person = `in`.readString()
            url = `in`.readString()
        }

        override fun toString(): String {
            return "NoticeListBean{" +
                    "img_path='" + img_path + '\'' +
                    ", id=" + id +
                    ", notice_date='" + notice_date + '\'' +
                    ", rownum=" + rownum +
                    ", title='" + title + '\'' +
                    ", unitname='" + unitname + '\'' +
                    ", send_person='" + send_person + '\'' +
                    ", url='" + url + '\'' +
                    '}'
        }

        override fun describeContents(): Int {
            return 0
        }

        override fun writeToParcel(parcel: Parcel, i: Int) {
            parcel.writeString(img_path)
            parcel.writeInt(id)
            parcel.writeString(notice_date)
            parcel.writeInt(rownum)
            parcel.writeString(title)
            parcel.writeString(unitname)
            parcel.writeString(send_person)
            parcel.writeString(url)
        }

        companion object {

            val CREATOR: Parcelable.Creator<NoticeListBean> = object : Parcelable.Creator<NoticeListBean> {
                override fun createFromParcel(`in`: Parcel): NoticeListBean {
                    return NoticeListBean(`in`)
                }

                override fun newArray(size: Int): Array<NoticeListBean?> {
                    return arrayOfNulls(size)
                }
            }
        }
    }

    companion object {

        val CREATOR: Parcelable.Creator<Notice> = object : Parcelable.Creator<Notice> {
            override fun createFromParcel(`in`: Parcel): Notice {
                return Notice(`in`)
            }

            override fun newArray(size: Int): Array<Notice?> {
                return arrayOfNulls(size)
            }
        }
    }
}
